import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

const path  = require("path")
const resolve = vpath => path.join(__dirname,vpath)

import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'



// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  css: {
    preprocessorOptions: {
      scss: {
        // 配置sass全局引入样式
        additionalData: `@import "@/../style/global.scss";`
      }
    }
  },
  resolve: {
    alias: {
      "@": resolve("src"),
      "@assets": resolve("assets"),
      "@scss": resolve("style"),
      "@c": resolve("components"),
      "@p": resolve("pages"),
      "@r": resolve("route"),
      "@utils": resolve("utils")
    }
  }
})
